package com.dsp.services.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.core.util.DspUtil;
import com.core.util.GenericDAO;
import com.core.util.GenericServiceHibernate;
import com.dsp.bean.JobsMessage;
import com.dsp.dao.JobsMessageDAO;
import com.dsp.services.JobsMessageService;

@Service(value = "jobsMessageService")
public class JobsMessageServiceImpl extends GenericServiceHibernate<JobsMessage, Long> implements JobsMessageService {

	private JobsMessageDAO jobsMessageDAO;

	@Resource(name = "jobsMessageDAO")
	public void setDao(GenericDAO<JobsMessage, Serializable> dao) {
		super.setDao(dao);
	}

	/**
	 * @return the jobsMessageDAO
	 */
	public JobsMessageDAO getJobsMessageDAO() {
		return jobsMessageDAO;
	}

	/**
	 * @param jobsMessageDAO the jobsMessageDAO to set
	 */
	public void setJobsMessageDAO(JobsMessageDAO jobsMessageDAO) {
		this.jobsMessageDAO = jobsMessageDAO;
	}

	@Override
	public StringBuffer constractHTML(List<JobsMessage> list) {
		StringBuffer rtnMessage= new StringBuffer();
		rtnMessage.append("<div class='showTip'>");
		if(DspUtil.isEmptyList(list) ==false){
			 for(JobsMessage message : list){
				 rtnMessage.append("<p>"+ message.getErrorInfo()+"</p>");
			 }
		}
		rtnMessage.append("</div>");
		return rtnMessage;
	}
	
}
